.class public Lcom/qiniu/resumableio/ResumableIO;
.super Ljava/lang/Object;
.source "ResumableIO.java"


# static fields
.field private static atomicId:I

.field static idCancels:Ljava/util/HashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/Integer;",
            "Lcom/qiniu/utils/ICancel;",
            ">;"
        }
    .end annotation
.end field


# instance fields
.field private BLOCK_SIZE:I

.field mClient:Lcom/qiniu/resumableio/ResumableClient;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .prologue
    .line 20
    const/4 v0, 0x0

    sput v0, Lcom/qiniu/resumableio/ResumableIO;->atomicId:I

    .line 21
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    sput-object v0, Lcom/qiniu/resumableio/ResumableIO;->idCancels:Ljava/util/HashMap;

    return-void
.end method

.method public constructor <init>(Lcom/qiniu/resumableio/ResumableClient;)V
    .registers 3
    .param p1, "client"    # Lcom/qiniu/resumableio/ResumableClient;

    .prologue
    .line 26
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 19
    const/high16 v0, 0x400000

    iput v0, p0, Lcom/qiniu/resumableio/ResumableIO;->BLOCK_SIZE:I

    .line 27
    iput-object p1, p0, Lcom/qiniu/resumableio/ResumableIO;->mClient:Lcom/qiniu/resumableio/ResumableClient;

    .line 28
    return-void
.end method

.method public constructor <init>(Ljava/lang/String;)V
    .registers 4
    .param p1, "uptoken"    # Ljava/lang/String;

    .prologue
    .line 23
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 19
    const/high16 v0, 0x400000

    iput v0, p0, Lcom/qiniu/resumableio/ResumableIO;->BLOCK_SIZE:I

    .line 24
    new-instance v0, Lcom/qiniu/resumableio/ResumableClient;

    invoke-static {}, Lcom/qiniu/auth/Client;->getMultithreadClient()Lorg/apache/http/client/HttpClient;

    move-result-object v1

    invoke-direct {v0, v1, p1}, Lcom/qiniu/resumableio/ResumableClient;-><init>(Lorg/apache/http/client/HttpClient;Ljava/lang/String;)V

    iput-object v0, p0, Lcom/qiniu/resumableio/ResumableIO;->mClient:Lcom/qiniu/resumableio/ResumableClient;

    .line 25
    return-void
.end method

.method static synthetic access$000(Lcom/qiniu/resumableio/ResumableIO;Ljava/lang/Integer;)V
    .registers 2
    .param p0, "x0"    # Lcom/qiniu/resumableio/ResumableIO;
    .param p1, "x1"    # Ljava/lang/Integer;

    .prologue
    .line 17
    invoke-direct {p0, p1}, Lcom/qiniu/resumableio/ResumableIO;->removeTask(Ljava/lang/Integer;)V

    return-void
.end method

.method public static convertFileUri(Landroid/content/Context;Landroid/net/Uri;)Landroid/net/Uri;
    .registers 11
    .param p0, "mContext"    # Landroid/content/Context;
    .param p1, "uri"    # Landroid/net/Uri;

    .prologue
    const/4 v8, 0x0

    const/4 v3, 0x0

    .line 161
    if-eqz p1, :cond_44

    const-string v0, "content"

    invoke-virtual {p1}, Landroid/net/Uri;->getScheme()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_44

    .line 162
    invoke-virtual {p0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const/4 v1, 0x1

    new-array v2, v1, [Ljava/lang/String;

    const-string v1, "_data"

    aput-object v1, v2, v8

    move-object v1, p1

    move-object v4, v3

    move-object v5, v3

    invoke-virtual/range {v0 .. v5}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v6

    .line 163
    .local v6, "cursor":Landroid/database/Cursor;
    invoke-interface {v6}, Landroid/database/Cursor;->moveToFirst()Z

    .line 164
    invoke-interface {v6, v8}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v7

    .line 165
    .local v7, "filePath":Ljava/lang/String;
    invoke-interface {v6}, Landroid/database/Cursor;->close()V

    .line 169
    .end local v6    # "cursor":Landroid/database/Cursor;
    :goto_2c
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "file://"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v0

    return-object v0

    .line 167
    .end local v7    # "filePath":Ljava/lang/String;
    :cond_44
    invoke-virtual {p1}, Landroid/net/Uri;->getPath()Ljava/lang/String;

    move-result-object v7

    .restart local v7    # "filePath":Ljava/lang/String;
    goto :goto_2c
.end method

.method public static defaultInstance(Ljava/lang/String;)Lcom/qiniu/resumableio/ResumableIO;
    .registers 4
    .param p0, "uptoken"    # Ljava/lang/String;

    .prologue
    .line 180
    new-instance v0, Lcom/qiniu/resumableio/ResumableIO;

    new-instance v1, Lcom/qiniu/resumableio/ResumableClient;

    invoke-static {}, Lcom/qiniu/auth/Client;->getMultithreadClient()Lorg/apache/http/client/HttpClient;

    move-result-object v2

    invoke-direct {v1, v2, p0}, Lcom/qiniu/resumableio/ResumableClient;-><init>(Lorg/apache/http/client/HttpClient;Ljava/lang/String;)V

    invoke-direct {v0, v1}, Lcom/qiniu/resumableio/ResumableIO;-><init>(Lcom/qiniu/resumableio/ResumableClient;)V

    return-object v0
.end method

.method private declared-synchronized newTask(Lcom/qiniu/utils/ICancel;)Ljava/lang/Integer;
    .registers 4
    .param p1, "c"    # Lcom/qiniu/utils/ICancel;

    .prologue
    .line 31
    monitor-enter p0

    :try_start_1
    sget-object v0, Lcom/qiniu/resumableio/ResumableIO;->idCancels:Ljava/util/HashMap;

    sget v1, Lcom/qiniu/resumableio/ResumableIO;->atomicId:I

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    invoke-virtual {v0, v1, p1}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 32
    sget v0, Lcom/qiniu/resumableio/ResumableIO;->atomicId:I

    add-int/lit8 v1, v0, 0x1

    sput v1, Lcom/qiniu/resumableio/ResumableIO;->atomicId:I

    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
    :try_end_15
    .catchall {:try_start_1 .. :try_end_15} :catchall_18

    move-result-object v0

    monitor-exit p0

    return-object v0

    .line 31
    :catchall_18
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public static put(Ljava/lang/String;Ljava/lang/String;Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/auth/JSONObjectRet;)I
    .registers 6
    .param p0, "uptoken"    # Ljava/lang/String;
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "isa"    # Lcom/qiniu/utils/InputStreamAt;
    .param p3, "extra"    # Lcom/qiniu/resumableio/PutExtra;
    .param p4, "ret"    # Lcom/qiniu/auth/JSONObjectRet;

    .prologue
    .line 188
    invoke-static {p0}, Lcom/qiniu/resumableio/ResumableIO;->defaultInstance(Ljava/lang/String;)Lcom/qiniu/resumableio/ResumableIO;

    move-result-object v0

    invoke-virtual {v0, p1, p2, p3, p4}, Lcom/qiniu/resumableio/ResumableIO;->put(Ljava/lang/String;Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/auth/JSONObjectRet;)I

    move-result v0

    return v0
.end method

.method public static putAndClose(Ljava/lang/String;Ljava/lang/String;Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/auth/JSONObjectRet;)I
    .registers 6
    .param p0, "uptoken"    # Ljava/lang/String;
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "isa"    # Lcom/qiniu/utils/InputStreamAt;
    .param p3, "extra"    # Lcom/qiniu/resumableio/PutExtra;
    .param p4, "ret"    # Lcom/qiniu/auth/JSONObjectRet;

    .prologue
    .line 184
    invoke-static {p0}, Lcom/qiniu/resumableio/ResumableIO;->defaultInstance(Ljava/lang/String;)Lcom/qiniu/resumableio/ResumableIO;

    invoke-static {p0, p1, p2, p3, p4}, Lcom/qiniu/resumableio/ResumableIO;->putAndClose(Ljava/lang/String;Ljava/lang/String;Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/auth/JSONObjectRet;)I

    move-result v0

    return v0
.end method

.method public static putFile(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/auth/JSONObjectRet;)I
    .registers 12
    .param p0, "mContext"    # Landroid/content/Context;
    .param p1, "uptoken"    # Ljava/lang/String;
    .param p2, "key"    # Ljava/lang/String;
    .param p3, "uri"    # Landroid/net/Uri;
    .param p4, "extra"    # Lcom/qiniu/resumableio/PutExtra;
    .param p5, "ret"    # Lcom/qiniu/auth/JSONObjectRet;

    .prologue
    .line 192
    invoke-static {p1}, Lcom/qiniu/resumableio/ResumableIO;->defaultInstance(Ljava/lang/String;)Lcom/qiniu/resumableio/ResumableIO;

    move-result-object v0

    move-object v1, p0

    move-object v2, p2

    move-object v3, p3

    move-object v4, p4

    move-object v5, p5

    invoke-virtual/range {v0 .. v5}, Lcom/qiniu/resumableio/ResumableIO;->putFile(Landroid/content/Context;Ljava/lang/String;Landroid/net/Uri;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/auth/JSONObjectRet;)I

    move-result v0

    return v0
.end method

.method private declared-synchronized removeTask(Ljava/lang/Integer;)V
    .registers 3
    .param p1, "id"    # Ljava/lang/Integer;

    .prologue
    .line 36
    monitor-enter p0

    :try_start_1
    sget-object v0, Lcom/qiniu/resumableio/ResumableIO;->idCancels:Ljava/util/HashMap;

    invoke-virtual {v0, p1}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_6
    .catchall {:try_start_1 .. :try_end_6} :catchall_8

    .line 37
    monitor-exit p0

    return-void

    .line 36
    :catchall_8
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public static declared-synchronized stop(I)V
    .registers 5
    .param p0, "id"    # I

    .prologue
    .line 173
    const-class v2, Lcom/qiniu/resumableio/ResumableIO;

    monitor-enter v2

    :try_start_3
    sget-object v1, Lcom/qiniu/resumableio/ResumableIO;->idCancels:Ljava/util/HashMap;

    invoke-static {p0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    invoke-virtual {v1, v3}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/qiniu/utils/ICancel;
    :try_end_f
    .catchall {:try_start_3 .. :try_end_f} :catchall_21

    .line 174
    .local v0, "c":Lcom/qiniu/utils/ICancel;
    if-nez v0, :cond_13

    .line 177
    :goto_11
    monitor-exit v2

    return-void

    .line 175
    :cond_13
    const/4 v1, 0x1

    :try_start_14
    invoke-interface {v0, v1}, Lcom/qiniu/utils/ICancel;->cancel(Z)Z

    .line 176
    sget-object v1, Lcom/qiniu/resumableio/ResumableIO;->idCancels:Ljava/util/HashMap;

    invoke-static {p0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    invoke-virtual {v1, v3}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_20
    .catchall {:try_start_14 .. :try_end_20} :catchall_21

    goto :goto_11

    .line 173
    .end local v0    # "c":Lcom/qiniu/utils/ICancel;
    :catchall_21
    move-exception v1

    monitor-exit v2

    throw v1
.end method


# virtual methods
.method public put(Ljava/lang/String;Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/auth/JSONObjectRet;)I
    .registers 34
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "input"    # Lcom/qiniu/utils/InputStreamAt;
    .param p3, "extra"    # Lcom/qiniu/resumableio/PutExtra;
    .param p4, "ret"    # Lcom/qiniu/auth/JSONObjectRet;

    .prologue
    .line 66
    invoke-virtual/range {p2 .. p2}, Lcom/qiniu/utils/InputStreamAt;->length()J

    move-result-wide v2

    move-object/from16 v0, p0

    iget v6, v0, Lcom/qiniu/resumableio/ResumableIO;->BLOCK_SIZE:I

    int-to-long v6, v6

    div-long/2addr v2, v6

    long-to-int v2, v2

    add-int/lit8 v17, v2, 0x1

    .line 67
    .local v17, "blkCount":I
    move-object/from16 v0, p3

    iget-object v2, v0, Lcom/qiniu/resumableio/PutExtra;->processes:[Lcom/qiniu/resumableio/PutRet;

    if-nez v2, :cond_1b

    move/from16 v0, v17

    new-array v2, v0, [Lcom/qiniu/resumableio/PutRet;

    move-object/from16 v0, p3

    iput-object v2, v0, Lcom/qiniu/resumableio/PutExtra;->processes:[Lcom/qiniu/resumableio/PutRet;

    .line 68
    :cond_1b
    invoke-virtual/range {p2 .. p2}, Lcom/qiniu/utils/InputStreamAt;->length()J

    move-result-wide v2

    move-object/from16 v0, p3

    iput-wide v2, v0, Lcom/qiniu/resumableio/PutExtra;->totalSize:J

    .line 69
    const/4 v2, 0x1

    new-array v0, v2, [I

    move-object/from16 v16, v0

    const/4 v2, 0x0

    const/4 v3, 0x0

    aput v3, v16, v2

    .line 70
    .local v16, "success":[I
    move/from16 v0, v17

    new-array v0, v0, [J

    move-object/from16 v18, v0

    .line 71
    .local v18, "uploaded":[J
    const/4 v2, 0x1

    move/from16 v0, v17

    filled-new-array {v0, v2}, [I

    move-result-object v2

    const-class v3, Lcom/qiniu/utils/ICancel;

    invoke-static {v3, v2}, Ljava/lang/reflect/Array;->newInstance(Ljava/lang/Class;[I)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, [[Lcom/qiniu/utils/ICancel;

    .line 72
    .local v4, "cancelers":[[Lcom/qiniu/utils/ICancel;
    const/4 v2, 0x1

    new-array v5, v2, [Z

    const/4 v2, 0x0

    const/4 v3, 0x0

    aput-boolean v3, v5, v2

    .line 73
    .local v5, "failure":[Z
    new-instance v2, Lcom/qiniu/resumableio/ResumableIO$2;

    move-object/from16 v3, p0

    move-object/from16 v6, p4

    move-object/from16 v7, p3

    invoke-direct/range {v2 .. v7}, Lcom/qiniu/resumableio/ResumableIO$2;-><init>(Lcom/qiniu/resumableio/ResumableIO;[[Lcom/qiniu/utils/ICancel;[ZLcom/qiniu/auth/JSONObjectRet;Lcom/qiniu/resumableio/PutExtra;)V

    move-object/from16 v0, p0

    invoke-direct {v0, v2}, Lcom/qiniu/resumableio/ResumableIO;->newTask(Lcom/qiniu/utils/ICancel;)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/Integer;->intValue()I

    move-result v11

    .line 86
    .local v11, "taskId":I
    const/4 v9, 0x0

    .local v9, "i":I
    :goto_5e
    move/from16 v0, v17

    if-ge v9, v0, :cond_d2

    .line 87
    move-object/from16 v0, p3

    iget-object v2, v0, Lcom/qiniu/resumableio/PutExtra;->processes:[Lcom/qiniu/resumableio/PutRet;

    aget-object v2, v2, v9

    if-eqz v2, :cond_8a

    .line 88
    move-object/from16 v0, p3

    iget-object v2, v0, Lcom/qiniu/resumableio/PutExtra;->processes:[Lcom/qiniu/resumableio/PutRet;

    aget-object v2, v2, v9

    iget v2, v2, Lcom/qiniu/resumableio/PutRet;->offset:I

    int-to-long v2, v2

    aput-wide v2, v18, v9

    .line 89
    aget-wide v2, v18, v9

    move-object/from16 v0, p0

    iget v6, v0, Lcom/qiniu/resumableio/ResumableIO;->BLOCK_SIZE:I

    int-to-long v6, v6

    cmp-long v2, v2, v6

    if-nez v2, :cond_8a

    .line 90
    const/4 v2, 0x0

    aget v3, v16, v2

    add-int/lit8 v3, v3, 0x1

    aput v3, v16, v2

    .line 86
    :goto_87
    add-int/lit8 v9, v9, 0x1

    goto :goto_5e

    .line 94
    :cond_8a
    move-object/from16 v0, p3

    iget-object v2, v0, Lcom/qiniu/resumableio/PutExtra;->processes:[Lcom/qiniu/resumableio/PutRet;

    aget-object v2, v2, v9

    if-nez v2, :cond_9d

    move-object/from16 v0, p3

    iget-object v2, v0, Lcom/qiniu/resumableio/PutExtra;->processes:[Lcom/qiniu/resumableio/PutRet;

    new-instance v3, Lcom/qiniu/resumableio/PutRet;

    invoke-direct {v3}, Lcom/qiniu/resumableio/PutRet;-><init>()V

    aput-object v3, v2, v9

    .line 95
    :cond_9d
    move-object/from16 v0, p0

    iget v2, v0, Lcom/qiniu/resumableio/ResumableIO;->BLOCK_SIZE:I

    mul-int/2addr v2, v9

    int-to-long v0, v2

    move-wide/from16 v20, v0

    .line 96
    .local v20, "startPos":J
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/qiniu/resumableio/ResumableIO;->mClient:Lcom/qiniu/resumableio/ResumableClient;

    move-object/from16 v22, v0

    move-object/from16 v0, p3

    iget-object v2, v0, Lcom/qiniu/resumableio/PutExtra;->processes:[Lcom/qiniu/resumableio/PutRet;

    aget-object v25, v2, v9

    new-instance v7, Lcom/qiniu/resumableio/ResumableIO$3;

    move-object/from16 v8, p0

    move-object/from16 v10, p3

    move-object/from16 v12, p1

    move-object/from16 v13, p2

    move-object/from16 v14, p4

    move-object v15, v5

    move-object/from16 v19, v4

    invoke-direct/range {v7 .. v21}, Lcom/qiniu/resumableio/ResumableIO$3;-><init>(Lcom/qiniu/resumableio/ResumableIO;ILcom/qiniu/resumableio/PutExtra;ILjava/lang/String;Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/auth/JSONObjectRet;[Z[II[J[[Lcom/qiniu/utils/ICancel;J)V

    move-object/from16 v23, p2

    move-object/from16 v24, p3

    move-wide/from16 v26, v20

    move-object/from16 v28, v7

    invoke-virtual/range {v22 .. v28}, Lcom/qiniu/resumableio/ResumableClient;->putblock(Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/resumableio/PutRet;JLcom/qiniu/auth/JSONObjectRet;)[Lcom/qiniu/utils/ICancel;

    move-result-object v2

    aput-object v2, v4, v9

    goto :goto_87

    .line 139
    .end local v20    # "startPos":J
    :cond_d2
    return v11
.end method

.method public putAndClose(Ljava/lang/String;Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/auth/JSONObjectRet;)I
    .registers 6
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "input"    # Lcom/qiniu/utils/InputStreamAt;
    .param p3, "extra"    # Lcom/qiniu/resumableio/PutExtra;
    .param p4, "ret"    # Lcom/qiniu/auth/JSONObjectRet;

    .prologue
    .line 40
    new-instance v0, Lcom/qiniu/resumableio/ResumableIO$1;

    invoke-direct {v0, p0, p2, p4}, Lcom/qiniu/resumableio/ResumableIO$1;-><init>(Lcom/qiniu/resumableio/ResumableIO;Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/auth/JSONObjectRet;)V

    invoke-virtual {p0, p1, p2, p3, v0}, Lcom/qiniu/resumableio/ResumableIO;->put(Ljava/lang/String;Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/auth/JSONObjectRet;)I

    move-result v0

    return v0
.end method

.method public putFile(Landroid/content/Context;Ljava/lang/String;Landroid/net/Uri;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/auth/JSONObjectRet;)I
    .registers 11
    .param p1, "mContext"    # Landroid/content/Context;
    .param p2, "key"    # Ljava/lang/String;
    .param p3, "uri"    # Landroid/net/Uri;
    .param p4, "extra"    # Lcom/qiniu/resumableio/PutExtra;
    .param p5, "ret"    # Lcom/qiniu/auth/JSONObjectRet;

    .prologue
    .line 147
    invoke-virtual {p3}, Landroid/net/Uri;->toString()Ljava/lang/String;

    move-result-object v2

    const-string v3, "file"

    invoke-virtual {v2, v3}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v2

    if-nez v2, :cond_10

    invoke-static {p1, p3}, Lcom/qiniu/resumableio/ResumableIO;->convertFileUri(Landroid/content/Context;Landroid/net/Uri;)Landroid/net/Uri;

    move-result-object p3

    .line 149
    :cond_10
    :try_start_10
    new-instance v1, Ljava/io/File;

    new-instance v2, Ljava/net/URI;

    invoke-virtual {p3}, Landroid/net/Uri;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/net/URI;-><init>(Ljava/lang/String;)V

    invoke-direct {v1, v2}, Ljava/io/File;-><init>(Ljava/net/URI;)V

    .line 150
    .local v1, "file":Ljava/io/File;
    invoke-virtual {v1}, Ljava/io/File;->exists()Z

    move-result v2

    if-eqz v2, :cond_2d

    invoke-static {v1}, Lcom/qiniu/utils/InputStreamAt;->fromFile(Ljava/io/File;)Lcom/qiniu/utils/InputStreamAt;

    move-result-object v2

    invoke-virtual {p0, p2, v2, p4, p5}, Lcom/qiniu/resumableio/ResumableIO;->putAndClose(Ljava/lang/String;Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/auth/JSONObjectRet;)I

    move-result v2

    .line 156
    .end local v1    # "file":Ljava/io/File;
    :goto_2c
    return v2

    .line 151
    .restart local v1    # "file":Ljava/io/File;
    :cond_2d
    new-instance v2, Ljava/lang/Exception;

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "file not exist: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {p3}, Landroid/net/Uri;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V

    invoke-virtual {p5, v2}, Lcom/qiniu/auth/JSONObjectRet;->onFailure(Ljava/lang/Exception;)V
    :try_end_4c
    .catch Ljava/net/URISyntaxException; {:try_start_10 .. :try_end_4c} :catch_4e

    .line 156
    .end local v1    # "file":Ljava/io/File;
    :goto_4c
    const/4 v2, -0x1

    goto :goto_2c

    .line 152
    :catch_4e
    move-exception v0

    .line 153
    .local v0, "e":Ljava/net/URISyntaxException;
    invoke-virtual {v0}, Ljava/net/URISyntaxException;->printStackTrace()V

    .line 154
    invoke-virtual {p5, v0}, Lcom/qiniu/auth/JSONObjectRet;->onFailure(Ljava/lang/Exception;)V

    goto :goto_4c
.end method

.method public putFile(Ljava/lang/String;Ljava/io/File;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/auth/JSONObjectRet;)I
    .registers 6
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "file"    # Ljava/io/File;
    .param p3, "extra"    # Lcom/qiniu/resumableio/PutExtra;
    .param p4, "ret"    # Lcom/qiniu/auth/JSONObjectRet;

    .prologue
    .line 143
    invoke-static {p2}, Lcom/qiniu/utils/InputStreamAt;->fromFile(Ljava/io/File;)Lcom/qiniu/utils/InputStreamAt;

    move-result-object v0

    invoke-virtual {p0, p1, v0, p3, p4}, Lcom/qiniu/resumableio/ResumableIO;->putAndClose(Ljava/lang/String;Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/auth/JSONObjectRet;)I

    move-result v0

    return v0
.end method
